package de.tmahr.android;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class GrundlagenActivity extends ListActivity
{
	private String activities[] = { "SimpleTest", "LifeCycleTestActivity",
			"SharedPreferenceTest", "AssetsTest", "SaveInstanceTest",
			"InternalStorageTest", "ExternalStorageTest", "SensorTest",
			"ThreadTest", "SingleTouchTest", "SoundPoolTest", "SpeechTest",
			"SimpleGraphicsTest", "AdvancedGraphicsTest", "FontTest",
			"LayoutGraphicsTest", "LayoutGraphicsTest2", "LayoutGraphicsTest3",
			"DiagrammTest", "SensorTest2" };

	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setListAdapter(new ArrayAdapter<String>(this,
				android.R.layout.simple_list_item_1, activities));
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id)
	{
		super.onListItemClick(l, v, position, id);
		String activityName = activities[position];
		try
		{
			Class c = Class.forName("de.tmahr.android." + activityName);
			Intent intent = new Intent(this, c);
			startActivity(intent);
		}
		catch (ClassNotFoundException e)
		{
			e.printStackTrace();
		}
	}
}